<template>
  <div class="new">
    <div class="new-title">新闻推荐</div>
    <div class="new-list cur" v-for='(item,index) in list' :key='index' @click='setId(item)'>
      <div class="new-box">
        <div class="new-box-img">
          <img :src="item.newsImgUrl" alt="">
        </div>
        <div class="new-box-title">
          {{item.newsTitle}}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
      }
    },
    computed: {
      list(){
        return this.$store.state.Details
        
      }
    },
    mounted() {
    },
    methods:{
      setId(item){
        this.$emit("getId",item)
      }
    }
  }
</script>

<style lang="scss">
  .new {
    .new-title {
      color: #555555;
      font-size: 16px;
      font-weight: 600;
    }
    .new-list {
      margin-top: 20px;
      .new-box {
        width: 298px;
        height: 253px;
        border: 1px solid #333333;
        text-align: center;
        .new-box-img {
          width: 260px;
          height: 180px;
          margin: 20px auto;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .new-box-title {
          white-space:nowrap;//不换行
          overflow: hidden;//超出隐藏
          text-overflow: ellipsis;//变成...
        }
      }
    }
  }
</style>